




(function(d,r){function A(a,c,b){return[parseInt(a[0],10)*(s.test(a[0])?c/100:1),parseInt(a[1],10)*(s.test(a[1])?b/100:1)]}function v(a,c){return parseInt(d.css(a,c),10)||0}d.ui=d.ui||{};var o,w=Math.max,m=Math.abs,B=Math.round,t=/left|center|right/,x=/top|center|bottom/,y=/[\+\-]\d+%?/,C=/^\w+/,s=/%$/,D=d.fn.position;d.position={scrollbarWidth:function(){if(o!==r)return o;var a,c,b=d("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>");
c=b.children()[0];d("body").append(b);a=c.offsetWidth;b.css("overflow","scroll");c=c.offsetWidth;a===c&&(c=b[0].clientWidth);b.remove();return o=a-c},getScrollInfo:function(a){var c=a.isWindow?"":a.element.css("overflow-x"),b=a.isWindow?"":a.element.css("overflow-y"),b="scroll"===b||"auto"===b&&a.height<a.element[0].scrollHeight;return{width:"scroll"===c||"auto"===c&&a.width<a.element[0].scrollWidth?d.position.scrollbarWidth():0,height:b?d.position.scrollbarWidth():0}},getWithinInfo:function(a){var a=
d(a||window),c=d.isWindow(a[0]);return{element:a,isWindow:c,offset:a.offset()||{left:0,top:0},scrollLeft:a.scrollLeft(),scrollTop:a.scrollTop(),width:c?a.width():a.outerWidth(),height:c?a.height():a.outerHeight()}}};d.fn.position=function(a){if(!a||!a.of)return D.apply(this,arguments);var a=d.extend({},a),c,b,e,k,g,f=d(a.of),l=d.position.getWithinInfo(a.within),j=d.position.getScrollInfo(l),h=f[0],u=(a.collision||"flip").split(" "),o={};9===h.nodeType?(b=f.width(),e=f.height(),k={top:0,left:0}):d.isWindow(h)?
(b=f.width(),e=f.height(),k={top:f.scrollTop(),left:f.scrollLeft()}):h.preventDefault?(a.at="left top",b=e=0,k={top:h.pageY,left:h.pageX}):(b=f.outerWidth(),e=f.outerHeight(),k=f.offset());g=d.extend({},k);d.each(["my","at"],function(){var b=(a[this]||"").split(" "),c,e;b.length===1&&(b=t.test(b[0])?b.concat(["center"]):x.test(b[0])?["center"].concat(b):["center","center"]);b[0]=t.test(b[0])?b[0]:"center";b[1]=x.test(b[1])?b[1]:"center";c=y.exec(b[0]);e=y.exec(b[1]);o[this]=[c?c[0]:0,e?e[0]:0];a[this]=
[C.exec(b[0])[0],C.exec(b[1])[0]]});1===u.length&&(u[1]=u[0]);"right"===a.at[0]?g.left+=b:"center"===a.at[0]&&(g.left+=b/2);"bottom"===a.at[1]?g.top+=e:"center"===a.at[1]&&(g.top+=e/2);c=A(o.at,b,e);g.left+=c[0];g.top+=c[1];return this.each(function(){var h,r,n=d(this),p=n.outerWidth(),q=n.outerHeight(),s=v(this,"marginLeft"),t=v(this,"marginTop"),x=p+s+v(this,"marginRight")+j.width,y=q+t+v(this,"marginBottom")+j.height,i=d.extend({},g),z=A(o.my,n.outerWidth(),n.outerHeight());if(a.my[0]==="right")i.left=
i.left-p;else if(a.my[0]==="center")i.left=i.left-p/2;if(a.my[1]==="bottom")i.top=i.top-q;else if(a.my[1]==="center")i.top=i.top-q/2;i.left=i.left+z[0];i.top=i.top+z[1];if(!d.support.offsetFractions){i.left=B(i.left);i.top=B(i.top)}h={marginLeft:s,marginTop:t};d.each(["left","top"],function(f,k){if(d.ui.position[u[f]])d.ui.position[u[f]][k](i,{targetWidth:b,targetHeight:e,elemWidth:p,elemHeight:q,collisionPosition:h,collisionWidth:x,collisionHeight:y,offset:[c[0]+z[0],c[1]+z[1]],my:a.my,at:a.at,within:l,
elem:n})});d.fn.bgiframe&&n.bgiframe();a.using&&(r=function(c){var d=k.left-i.left,g=d+b-p,h=k.top-i.top,j=h+e-q,l={target:{element:f,left:k.left,top:k.top,width:b,height:e},element:{element:n,left:i.left,top:i.top,width:p,height:q},horizontal:g<0?"left":d>0?"right":"center",vertical:j<0?"top":h>0?"bottom":"middle"};if(b<p&&m(d+g)<b)l.horizontal="center";if(e<q&&m(h+j)<e)l.vertical="middle";l.important=w(m(d),m(g))>w(m(h),m(j))?"horizontal":"vertical";a.using.call(this,c,l)});n.offset(d.extend(i,
{using:r}))})};d.ui.position={fit:{left:function(a,c){var b=c.within,e=b.isWindow?b.scrollLeft:b.offset.left,d=b.width,g=a.left-c.collisionPosition.marginLeft,b=e-g,f=g+c.collisionWidth-d-e;c.collisionWidth>d?0<b&&0>=f?(e=a.left+b+c.collisionWidth-d-e,a.left+=b-e):a.left=0<f&&0>=b?e:b>f?e+d-c.collisionWidth:e:a.left=0<b?a.left+b:0<f?a.left-f:w(a.left-g,a.left)},top:function(a,c){var b=c.within,e=b.isWindow?b.scrollTop:b.offset.top,d=c.within.height,g=a.top-c.collisionPosition.marginTop,b=e-g,f=g+
c.collisionHeight-d-e;c.collisionHeight>d?0<b&&0>=f?(e=a.top+b+c.collisionHeight-d-e,a.top+=b-e):a.top=0<f&&0>=b?e:b>f?e+d-c.collisionHeight:e:a.top=0<b?a.top+b:0<f?a.top-f:w(a.top-g,a.top)}},flip:{left:function(a,c){var b=c.within,e=b.offset.left+b.scrollLeft,d=b.width,g=b.isWindow?0:b.offset.left,f=a.left-c.collisionPosition.marginLeft,b=f-g,l=f+c.collisionWidth-d-g,f="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,j="left"===c.at[0]?c.targetWidth:"right"===c.at[0]?-c.targetWidth:
0,h=-2*c.offset[0];if(0>b){if(e=a.left+f+j+h+c.collisionWidth-d-e,0>e||e<m(b))a.left+=f+j+h}else if(0<l&&(e=a.left-c.collisionPosition.marginLeft+f+j+h-g,0<e||m(e)<l))a.left+=f+j+h},top:function(a,c){var b=c.within,e=b.offset.top+b.scrollTop,d=b.height,g=b.isWindow?0:b.offset.top,f=a.top-c.collisionPosition.marginTop,b=f-g,l=f+c.collisionHeight-d-g,f="top"===c.my[1]?-c.elemHeight:"bottom"===c.my[1]?c.elemHeight:0,j="top"===c.at[1]?c.targetHeight:"bottom"===c.at[1]?-c.targetHeight:0,h=-2*c.offset[1];
if(0>b){if(e=a.top+f+j+h+c.collisionHeight-d-e,a.top+f+j+h>b&&(0>e||e<m(b)))a.top+=f+j+h}else if(0<l&&(e=a.top-c.collisionPosition.marginTop+f+j+h-g,a.top+f+j+h>l&&(0<e||m(e)<l)))a.top+=f+j+h}},flipfit:{left:function(){d.ui.position.flip.left.apply(this,arguments);d.ui.position.fit.left.apply(this,arguments)},top:function(){d.ui.position.flip.top.apply(this,arguments);d.ui.position.fit.top.apply(this,arguments)}}};(function(){var a,c,b,e,k=document.getElementsByTagName("body")[0];b=document.createElement("div");
a=document.createElement(k?"div":"body");c={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};k&&d.extend(c,{position:"absolute",left:"-1000px",top:"-1000px"});for(e in c)a.style[e]=c[e];a.appendChild(b);c=k||document.documentElement;c.insertBefore(a,c.firstChild);b.style.cssText="position: absolute; left: 10.7432222px;";b=d(b).offset().left;d.support.offsetFractions=10<b&&11>b;a.innerHTML="";c.removeChild(a)})();!1!==d.uiBackCompat&&function(a){var c=a.fn.position;a.fn.position=
function(b){if(!b||!b.offset)return c.call(this,b);var e=b.offset.split(" "),d=b.at.split(" ");1===e.length&&(e[1]=e[0]);/^\d/.test(e[0])&&(e[0]="+"+e[0]);/^\d/.test(e[1])&&(e[1]="+"+e[1]);1===d.length&&(/left|center|right/.test(d[0])?d[1]="center":(d[1]=d[0],d[0]="center"));return c.call(this,a.extend(b,{at:d[0]+e[0]+" "+d[1]+e[1],offset:r}))}}(jQuery)})(jQuery);
/*
 Copyright(c)2010 PingAn Inc.
*/
(function(b){b.widget("ui.popup",{_init:function(){var a=this;this.offset={top:0,left:0};this.container=b('<div class="pa_ui_popup_container"></div>').hide().css({position:"absolute"}).append(a.element.show()).bgiframe().appendTo("body");var d=document.documentElement.clientWidth+b(document).scrollLeft(),e=document.documentElement.clientHeight+b(document).scrollTop(),c=(d-a.container.outerWidth())/2,e=(e-a.container.outerHeight())/2;if(a.options.anchor&&a.options.anchor.id){var f="string"==typeof a.options.anchor.id?
b("#"+a.options.anchor.id):b(a.options.anchor.id),c=f.offset().left,e=f.offset().top+f.outerHeight(),g=a.container.outerWidth();g+c>d&&(c=c-g+f.outerWidth(),0>c&&(c=0))}this.offset.left=c;this.offset.top=e;a.container.css({left:c,top:e});a._isOpen=!1;d=this.options.triggerClose;"click"==d?b(document).bind("click."+a.widgetName,function(){}):"mouseout"==d&&a.container.bind("mouseout."+a.widgetName,function(){});b(window).bind("resize.popup",function(){a._resetPos()});return this}})})(jQuery);
/*
 Copyright(c)2010 PingAn Inc.
*/
(function(b){b.widget("ui.dropselect",{options:{canInput:!0,resizable:!1,currentOpen:null,autofill:!0,bgiframe:!1,trigger:2,customClass:"pa_ui_dropselect_custom",cssSelecting:"pa_ui_dropselect_selecting",cssItem:"pa_ui_dropselect_item",cssOptGroup:"pa_ui_dropselect_optgroup",cssSelectItem:"pa_ui_dropselect_item_select",setPos:{my:"left top",at:"left bottom",collision:"flip none",offset:"0 -1"},initCallback:""},_create:function(){this.element.is(":not(select)")||(this._build(),this._bind(),this.element.css("border",
0),this.element.hide())},_build:function(){var a=this,d=this.options;if(a.element.hasClass("pa_ui_dropselect_dropped"))return a;this.isShow=!1;this.selectValue=a.element.val();this.selectText=this._selectText(this.selectValue);this.otitleValue=a.element.attr("otitle");this.offsetSaved=a.element.offset();this.heightSaved=a.element.outerHeight();this.element.height();this.inputContainer=b('<span class="pa_ui_dropselect_input_Container"></span>');this.input=b('<input type="text" class="pa_ui_dropselect_input"/>').val(this.selectText);
this.options.canInput?this.input.attr("readonly","false").removeAttr("readonly"):this.input.attr("readonly","false");1==this.options.trigger&&this.input.bind("click",function(){b.ui.dropselect.currentOpen&&b.ui.dropselect.currentOpen!=a.element[0]&&b(b.ui.dropselect.currentOpen).dropselect("close")});2==this.options.trigger&&this.input.bind("click",function(b){a._trigger("drop",b,null);a.change();a._clickButton();d.searchable&&this.select()});this.button=b('<span class="pa_ui_dropselect_button"><b></b></span>').bind("click",
function(b){a._trigger("drop",b,null);a.change();a._clickButton()});""!==this.otitleValue&&(this.input.attr("otitle",this.otitleValue),this.button.attr("otitle",this.otitleValue));this.inputContainer.append(this.input);this.dropselect=b('<div class="pa_ui_dropselect"></div>').append(b('<div class="pa_ui_dropselect_inner paui-clearfix"></div>').append(this.inputContainer).append(this.button));this.popselect=b('<div class="pa_ui_dropselect_popup"></div>').hide().addClass(a.options.customClass).width(this.element.width()).append(this._getHtml());
this._buildPopup();a.element.after(this.popselect).after(this.dropselect).addClass("pa_ui_dropselect_dropped").bind("casselectchange",function(){a.input.val(a._selectText(a.element.val()))}).bind("propertychange",function(){a.input.val(a._selectText(a.element.val()))});a.dropselect.show();if(0!==a.element.outerWidth()){this.dropselect.width(a.element.outerWidth());var c=a.dropselect.children().css("borderLeftWidth"),f=a.dropselect.children().css("borderRightWidth"),e=a.dropselect.find("input").css("paddingLeft"),
e=e.replace("px",""),g=a.dropselect.find("input").css("paddingRight"),g=g.replace("px",""),c=c.replace("px",""),f=f.replace("px",""),h=a.dropselect.find("input").css("borderLeftWidth"),h=h.replace("px",""),i=a.dropselect.find("input").css("borderRightWidth"),i=i.replace("px",""),c=Number(c)+Number(f);this.input.width(a.element.outerWidth()-c-(Number(h)+Number(i))-a.button.outerWidth()-e-g);this.inputContainer.width(a.element.outerWidth()-c-a.button.outerWidth())}else 0!==this.element.css("width")&&
0!==this.button.css("width")&&(e=parseInt(this.element.css("width"),10),g=parseInt(this.button.css("width"),10),isNaN(e)||(this.dropselect.width(e),this.input.width(e-g),this.popselect.width(this.element.css("width"))));a.element[0].watch&&a.element[0].watch("value",function(b,c,d){a.element.val(d);a.element.attr("value",d);a.input.val(a._selectText(d))});a.element[0].watch&&a.element[0].watch("disabled",function(b,c,d){if(d){a.element.attr("disabled","");a.input.addClass("pa_ui_dropselect_disabled_input");
a.button.addClass("pa_ui_dropselect_disabled_button")}else{a.element.attr("disabled","true");a.input.removeClass("pa_ui_dropselect_disabled_input");a.button.removeClass("pa_ui_dropselect_disabled_button")}});a.options.searchable&&(a.liList=[],a.liList1=[],a.liList2=[],a._searchable());a.options.initCallback&&a.options.initCallback(a.dropselect,a.popselect)},_init:function(){},_bind:function(){var a=this;b(document).bind("keydown.dropselect",function(d){var c=b(a.popselect).css("display"),f="."+a.options.cssSelectItem,
e="";if("block"==c)if(window.event&&(d=window.event),c=d.charCode||d.keyCode,38==c)0<b(a.popselect).find(f).prev().size()&&(b(a.popselect).find(f).addClass(a.options.cssItem).removeClass(a.options.cssSelectItem).prev().addClass(a.options.cssSelectItem),e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.trigger("change"),a._trigger("select",d,null));else if(40==c)0<b(a.popselect).find(f).next().size()&&(b(a.popselect).find(f).addClass(a.options.cssItem).removeClass(a.options.cssSelectItem).next().addClass(a.options.cssSelectItem),
e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.trigger("change"),a._trigger("select",d,null));else if(13==c&&a.isShow)return e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.blur(),a.close(),a.element.trigger("change"),a._trigger("select",d,null),!1})},_clickExternal:function(a){a=b(a.target);!a.hasClass("pa_ui_dropselect_input")&&!a.hasClass("pa_ui_dropselect_button")&&!a.parent().hasClass("pa_ui_dropselect_button")&&
this.close()},_show:function(){b.ui.dropselect.currentOpen&&b.ui.dropselect.currentOpen!=this.element[0]&&b(b.ui.dropselect.currentOpen).dropselect("close");b.ui.dropselect.currentOpen=this.element[0];var a=this,d={of:this.dropselect};b.extend(d,a.options.setPos);this.popselect.show().position(d);this.isShow=!0;this.button.addClass(this.options.cssSelecting);this.input.addClass(this.options.cssSelecting);this.popselect.addClass(this.options.cssSelecting);var a=this,c=null;this.popselect.find("li").each(function(){b(this).attr("v")==
a.element.val()&&(c=this,b(this).addClass(a.options.cssSelectItem).removeClass(a.options.cssItem))});var a=this,d=a.popselect.find("ul").height(),f=a.popselect.height();d<f&&a.popselect.find(".pa_ui_dropselect_box").height(d).css("overflow","hidden");c&&(d=b(c).position().top,f=b(c).parent().parent().height(),d>f&&b(c).parent().parent().scrollTop(d))},_clickButton:function(){this.element.attr("disabled")||(this.isShow?this.close():this._show())},_selectText:function(a){var d=!1,c="";this.element.children("option").each(function(){!d&&
b(this).val()==a&&(b(this).attr("pa_ui_dropselect_selectable"),c=b(this).text(),d=!0)});return c.replace(/(^\s*)|(\s*$)/g,"")},_getHtml:function(){var a=this,d=this.element.children("option,optgroup"),c='<div class="pa_ui_dropselect_box">';0<d.length&&(c+='<ul class="">',b.each(d,function(){var d=b(this).attr("value"),e=b(this).attr("class")||" "+a.options.cssItem,g=b(this).text(),h=b(this).attr("pa_ui_dropselect_selectable");"OPTGROUP"==b(this)[0].tagName?(e=b(this).attr("class")||" "+a.options.cssOptGroup,
c+='<li t="'+g+'" v="'+d+'" class="'+e+'" pa_ui_dropselect_selectable="false"',b(this).attr("label")&&(c+='name="'+b(this).attr("name")+'"'),c+=">"+g+"</li>"):(c+='<li t="'+g+'" v="'+d+'" class="'+e+'"',h&&(c+=' pa_ui_dropselect_selectable="'+h+'"'),c+='><a href="javascript:void(0);" title="'+g+'" class="pa_ui_dropselect_item_link">'+g+"</a></li>")}),c+="</ul>");return c+="</div>"},_buildPopup:function(){var a=this;this.options.bgiframe&&this.iebgiframe();this.popselect.find("li").click(function(d){for(var c=
d.target;c!=this&&c.parentNode;)c=c.parentNode;"false"!==b(this).attr("pa_ui_dropselect_selectable")&&(c=b(c),a.input.val(c.text().replace(/(^\s*)|(\s*$)/g,"")),a.element.val(c.attr("v")),a.element.trigger("change"),a._trigger("select",d,null),a.element.blur(),a.close());return!1});b(document).bind("click.dropselect",function(b){a._clickExternal(b)});this.options.resizable&&b(".pa_ui_dropselect_box",this.popselect).resizable({handles:"s"})},setDisabled:function(a){"true"==a?(this.element.attr("disabled",
"true"),this.input.addClass("pa_ui_dropselect_disabled_input").attr("disabled","true"),this.button.addClass("pa_ui_dropselect_disabled_button").attr("disabled","true")):(this.element.removeAttr("disabled"),this.input.removeClass("pa_ui_dropselect_disabled_input").removeAttr("disabled"),this.button.removeClass("pa_ui_dropselect_disabled_button").removeAttr("disabled"))},setValue:function(a){this.input.val(this._selectText(a));this.element.val(a);this.element.attr("value",a)},change:function(){this.popselect.empty().addClass("pa_ui_dropselect_popup").width(this.input.closest(".pa_ui_dropselect_inner").outerWidth()).append(this._getHtml());
this._buildPopup();this.options.initCallback&&this.options.initCallback(this.dropselect,this.popselect);return this},close:function(){this.popselect.hide();this.button.removeClass(this.options.cssSelecting);this.input.removeClass(this.options.cssSelecting);this.popselect.removeClass(this.options.cssSelecting);this._trigger("undrop",null,null);this.isShow=!1;b.ui.dropselect.currentOpen==this.element[0]&&(b.ui.dropselect.currentOpen=this.element[0])},iebgiframe:function(a){var d=/MSIE 6.0/ig.test(navigator.appVersion),
c=/MSIE 7.0/ig.test(navigator.appVersion),f=/MSIE 8.0/ig.test(navigator.appVersion);if(b.browser.msie&&(d||c||f)){var a=b.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},a||{}),d=function(a){return a&&a.constructor==Number?a+"px":a},e='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+a.src+'"style="display:block;position:absolute;z-index:-1;'+(!1!==a.opacity?"filter:Alpha(Opacity='0');":"")+"top:"+("auto"==a.top?"expression(((parseInt(this.parentNode&&this.parentNode.currentStyle&&this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
d(a.top))+";left:"+("auto"==a.left?"expression(((parseInt(this.parentNode&&this.parentNode.currentStyle&&this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":d(a.left))+";width:"+("auto"==a.width?"expression(this.parentNode.offsetWidth+'px')":d(a.width))+";height:"+("auto"==a.height?"expression(this.parentNode.offsetHeight+'px')":d(a.height))+';"/>';this.popselect.each(function(){0==b("> iframe.bgiframe",this).length&&this.insertBefore(document.createElement(e),this.firstChild)})}},destroy:function(){b.Widget.prototype.destroy.call(this);
this.element.removeClass("pa_ui_dropselect_dropped").show();this.input.remove();this.button.remove();this.popselect.remove();this.dropselect.remove()}})})(jQuery);
(function(d,g){d.widget("ui.dropselect",d.ui.dropselect,{options:{searchable:!1,searchDelay:100,currentOpen:null,suggest:!1,minLength:2,maxCount:10,pinyin:!1,sort:1},_searchable:function(){var a=this;(this.options.canInput||2!==!this.options.trigger)&&this.input.bind("keyup.dropselect",function(b){a.options.suggest?a._suggest(b):a._search(b)})},_suggest:function(a){var b=this,c=(a||window.event).keyCode;if(65<=c&&90>=c||48<=c&&57>=c||96<=c&&105>=c||46==c||8==c||32==c)clearTimeout(b.timeSearch),b.timeSearch=
setTimeout(function(){b.searchsuggest(null,a)},b.options.searchDelay)},_search:function(a){var b=this,a=(a||window.event).keyCode;b.liList.length=0;d(b.element).children("option").each(function(a){b.liList[a]=d(this).text();b.liList1[a]=d(this).attr("value")});if(65<=a&&90>=a||48<=a&&57>=a||96<=a&&105>=a||46==a||8==a||32==a){var b=this,a=this.input.val(),c=[],c=b._getLi(a);this.popselect.empty();0<c.length&&(this.popselect.addClass("pa_ui_dropselect_popup").append(b._setLi(c)),this.popselect.find("li").eq(0).addClass(b.options.cssSelectItem).removeClass(b.options.cssItem),
this.popselect.find("li").click(function(a){b.input.val(d(this).text().replace(/(^\s*)|(\s*$)/g,""));b.element.val(d(this).attr("v"));b.element.trigger("change");b._trigger("select",a,null);b.element.blur();b.close();return!1}),this.isShow||(this.popselect.show(),this.isShow=!0))}},_getLi:function(a){var b=[],c=0;for(i=0;i<this.liList.length;i++)0==this.liList[i].indexOf(a)&&(b[c]=this.liList[i],this.liList2[c]=this.liList1[i],c++);return b},_setLi:function(a){var b=this,c='<div class="pa_ui_dropselect_box"><ul>';
d.each(a,function(d){var f=a[d];c+='<li t="'+f+'" v="'+b.liList2[d]+'" class="pa_ui_dropselect_item"><a href="javascript:void(0);" title="'+f+'" class="pa_ui_dropselect_item_link">'+f+"</a></li>"});return c+="</ul></div>"},searchsuggest:function(a,b){var c=a?a:d.trim(this.input.val()),e=(b||window.event).keyCode;clearTimeout(this.timeClose);this.input.addClass("pa_ui_dropselect_searching");c.length>=this.options.minLength?(this._searchsuggest(c,b),8!=e&&this.options.autofill&&0<this.liList.length&&
!1==this.options.pinyin&&this._autoFill(c,this.liList[0])):this.close()},_searchsuggest:function(a){var b=this,c=this.options.data,e=[];e.length=0;d(b.element).children("option").each(function(a){e[a]=b.options.pinyin?[d(this).text(),d(this).attr("value"),d(this).attr("pinyin")]:[d(this).text(),d(this).attr("value")]});c=e;d.isArray(c)?(a=b.localSearch(c,a),this.input.removeClass("pa_ui_dropselect_searching"),b._sort(a)):b.options.pinyin&&(a=b.pinyinSearch(c,a),b.element.removeClass("pa_ui_dropselect_searching"),
b._sort(a))},_showResult:function(a){var b=this;d.trim(b.input.val());d.each(a,function(a,d){b.liList2[a]=d[1]});d.each(a,function(b,d){a[b]=d[0]});this.liList=a;this.popselect.empty();0<a.length?(this.popselect.addClass("pa_ui_dropselect_popup").append(b._setLi(a)),this.popselect.find("li").eq(0).addClass(b.options.cssSelectItem).removeClass(b.options.cssItem),this.popselect.find("li").click(function(a){b.input.val(d(this).text().replace(/(^\s*)|(\s*$)/g,""));b.element.val(d(this).attr("v"));b.element.trigger("change");
b._trigger("select",a,null);b.element.blur();b.close();return!1}),this.isShow||(this.popselect.show(),this.isShow=!0)):b.liList2.length=0},_autoFill:function(a,b){this.input.val(b);this.input.selection(a.length,a.length+b.length)},_sort:function(a){var b=this,c=[];if(a&&0<a.length)switch(this.options.sort){case 0:b._showResult(a);break;case 1:d.each(a,function(a,b){c[a]=b[0]+"_"+b[1]});c=c.sort(function(a,b){return a.localeCompare(b)});d.each(c,function(b,c){a[b]=c.split("_")});b._showResult(a);break;
case 2:var e=this.options.hotsorturl;e?d.getJSON(e,{result:a},function(c){a=c;b._showResult(a)}):b._showResult(a)}else b.popselect.empty(),this.liList.length=0},localSearch:function(a,b){var c=RegExp(b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1"),"i");return d.grep(a,function(a){return c.test(a)})},pinyinSearch:function(a,b){var c=[];d.each(a,function(d){-1!=a.indexOf(b)&&c.push(d)});return c}});d.fn.selection=function(a,b){if(a!==g)return this.each(function(){if(this.createTextRange){var c=
this.createTextRange();b===g||a==b?c.move("character",a):(c.collapse(!0),c.moveStart("character",a),c.moveEnd("character",b));c.select()}else this.setSelectionRange?this.setSelectionRange(a,b):this.selectionStart&&(this.selectionStart=a,this.selectionEnd=b)})}})(jQuery);
